package com.kkb.kkbportal.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Range;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 *
 * </p>
 *
 * @author 杜垣均
 * @since 2021-08-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Carousel对象", description = "Carousel对象")
@NotNull(message = "对象不能为空")
public class Carousel implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "轮播图id")
    @TableId(value = "id", type = IdType.AUTO)
    @Null(groups = AddGroup.class, message = "添加不需要指定id")
    @NotNull(groups = UpdateGroup.class, message = "id不能为空")
    private Long id;

    @ApiModelProperty(value = "轮播图名称", required = true)
    @NotEmpty(message = "轮播图名不能为空")
    private String name;

    @ApiModelProperty(value = "轮播图图像链接", required = true)
    @NotEmpty(message = "图像链接不能为空")
    @URL(message = "图像链接必须符合url格式")
    private String pic;

    @ApiModelProperty(value = "轮播图跳转地址")
    @URL(message = "轮播图跳转地址必须符合url格式")
    private String url;

    @ApiModelProperty(value = "0-表示所有轮播图，1-表示已上首页展示的轮播图，2-表示暂未上首页展示的轮播图")
    @NotNull(message = "状态码不能为空")
    @Range(min = 0, max = 2, message = "状态码必须在0-2之间")
    private Integer state;

    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "修改时间")
    private LocalDateTime updateTime;

    @ApiModelProperty(value = "0-未删除，其他（id）-已删除")
    @TableLogic(delval = "id")
    @TableField("is_deleted")
    private Long deleted;


}
